<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="stylesheet_1.css">
        <title>Add User</title>

        <style>
            .error {
                color: #ff0000;
                font-style: italic;
            }
        </style>
    </head>
    <body>
    <style>
        form label {
            float: left;
            width: 120px;
            text-align: left;
            position: relative;
            top: 2px;
            margin-right: 5px;
        }
    </style>
</head>
<body>

    <p align="right"><c:out value = "${sessionScope.firstName} ${sessionScope.lastName}" default="" />
        (<a href="login.jsp">Logout</a>)
    </p>

    <h1>Add new user</h1>

    <form:form method="POST" commandName="user" action="AddUser"></
        <div>
            <label>Login: </label><input type="text" name="login" required> <font color="red">*</font></p>
            <label>Password: </label><input type="password" name="password" required> <font color="red">*</font></p>
            <label>Password again: </label><input type="password" name="passwordagain" required> <font color="red">*</font></p>
            <label>E-mail: </label><input type="email" name="email" required> <font color="red">*</font></p>
            <label>First name: </label><input type="text" name="firstname" required> <font color="red">*</font></p>
            <label>Last name: </label><input type="text" name="lastname"required> <font color="red">*</font></p>
            <label>Birthday: </label><input type="text" name="birth" required> <font color="red">*</font> format: yyyy-MM-dd </p>
            <label>Role:</label>
            <select name="role">
                <option value="User">User</option>
                <option value="Admin">Admin</option>
            </select><font color="red"> *</font></p>

            <script type="text/javascript">
                var RecaptchaOptions = {
                    theme: 'white'
                };
            </script>

            <script type="text/javascript"
                    src="http://www.google.com/recaptcha/api/challenge?k=6LcvdOUSAAAAAHJSSKB6ESG2Km7t8OKrGND4KAT-">
            </script>
            <noscript>
                <iframe src="http://www.google.com/recaptcha/api/noscript?k=6LcvdOUSAAAAAHJSSKB6ESG2Km7t8OKrGND4KAT-"
                        height="300" width="500" frameborder="0"></iframe><br>
                <textarea name="recaptcha_challenge_field" rows="3" cols="40">
                </textarea>
                <input type="hidden" name="recaptcha_response_field"
                       value="manual_challenge">
            </noscript>


            <input type="submit" value="Ok" onclick="AddUser" />
            <input  type="button" value="Cancel" onclick="javascript:history.back();" />
        </div>
    </form:form>


</body>

<p align="center">
    <span style="color: red">
        <% if ((request.getAttribute("error")) != null) {
                out.println(request.getAttribute("error"));
            }
        %> 
    </span>
</p>


</html>